<template>
  <div>
    <el-dialog
      :title="title"
      :visible="dialogVisible"
      :show-close="false"
      width="1000px"
    >
      <manage-info :row="row" />
      <span slot="footer">
        <el-button
          @click="handleCancel"
        >
          取 消
        </el-button>
        <el-button
          type="primary"
          @click="handleConfirm"
        >
          确 定
        </el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import ManageInfo from '@/components/ManageInfo'
export default {
  name: 'OrderManageDialog',
  components: {
    ManageInfo
  },
  props: {
    dialogVisible: {
      type: Boolean,
      default: false
    },
    row: {
      type: Object,
      default() {
        return {}
      }
    }
  },
  data() {
    return {
      title: '',
      folder: 'carState',
      uploadFile: '',
      form: {
        mileage: '',
        carStateImg: ''
      }
    }
  },
  methods: {
    handleCancel() {
      this.$emit('cancel-dialog')
      this.$refs.orderManageDialog.resetFields()
    },
    handleConfirm() {
      this.$refs.orderManageDialog.validate((valid) => {
        if (valid) {
          this.$emit('confirm-dialog', {
            id: this.row.id,
            mileage: this.row.mileage,
            carStateImg: this.row.carStateImg
          })
        } else {
          return false
        }
      })
    }
  }
}
</script>

<style>
</style>
